package com.example.travel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.travel.domain.entity.Article;
import com.example.travel.domain.entity.Spot;
import com.example.travel.mapper.ArticleMapper;
import com.example.travel.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author : LinQingLiang
 * @file : ArticleServiceImpl.java
 * @Since : 2023/2/15 8:48
 */

@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {

    @Autowired
    private ArticleMapper articleMapper;

    @Override
    public Page page(Integer pageNum, Integer pageSize, String name) {

        Page page = new Page(pageNum,pageSize);
        QueryWrapper<Article> wrapper = new QueryWrapper();
        wrapper.like(name != null && name != "","name",name);
        return articleMapper.page(page,wrapper);
    }



}
